package com.ssy.lingxi.system.entity;

import com.ssy.lingxi.system.handler.converter.JpaJsonToMapConverter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Map;

/**
 * 菜单编码
 * @author 万宁
 * @version 2.0.0
 * @date 2021-01-14
 */
@Entity
@Table(schema = "public", name = "cf_menu_code")
@ApiModel(value = "菜单编码")
public class MenuCode implements Serializable {
    private static final long serialVersionUID = -1736643108530541065L;

    /**
     * ID
     */
    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE,generator="menu_code_seq")
    @SequenceGenerator(sequenceName="cf_menu_code_seq", name="menu_code_seq",allocationSize = 1)
    @ApiModelProperty(value = "主键ID")
    private Long id;

    /**
     * 菜单编码
     */
    @Column(name  = "code")
    @ApiModelProperty(value = "菜单编码")
    private String code;

    /**
     * Url
     */
    @Column
    @ApiModelProperty(value = "菜单编码对应的Url")
    private String url;

    /**
     * 编码对应的客户端或平台
     */
    @Column
    @ApiModelProperty(value = "客户端平台枚举 1-能力中心 2-App  99-平台后台")
    private Integer source;

    /**
     * 属性描述
     */
    @Column(columnDefinition = "varchar(255)")
    @ApiModelProperty(value = "属性描述")
    private String remark;

    /**
     * 属性
     */
    @ApiModelProperty(value = "属性")
    @Convert(converter = JpaJsonToMapConverter.class)
    @Column(columnDefinition = "jsonb")
    private Map<String, Object> attrs;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Integer getSource() {
        return source;
    }

    public void setSource(Integer source) {
        this.source = source;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Map<String, Object> getAttrs() {
        return attrs;
    }

    public void setAttrs(Map<String, Object> attrs) {
        this.attrs = attrs;
    }
}
